﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using GFrame.Shadow;

namespace EZCRS.HCMS.Entity
{
    [GTable("HCRS_RateCode")]
    public class HCRS_RateCode
    {

        private int _id;
        private string _rate;
        private string _name;

        private string _Description;

        private string _guarule;

        private string _cxlrule;

        private int _pid;

        private string _ratecat;

        private int _status;

        private string _rpi; //种类

        private bool _basic;   //基础价
        private string _currency;   //货币

        private DateTime? _updatetime;


        public HCRS_RateCode(){}

        public HCRS_RateCode(DataRow dr)
        {
            if (dr != null)
            {
                _basic = false;

                if (dr["id"].ToString() != "") _id = Convert.ToInt32(dr["id"].ToString());

                if (dr["Property_id"].ToString() != "") _pid = Convert.ToInt32(dr["Property_id"].ToString());

                if (dr["status"].ToString() != "") _status = Convert.ToInt32(dr["status"].ToString());
                _rate = dr["rate"].ToString();
                _name = dr["name"].ToString();
                _Description = dr["Desc1"].ToString();

                if (dr["updatetime"].ToString() != "") 
                    _updatetime = Convert.ToDateTime(dr["updatetime"].ToString());

                if (dr["basis"].ToString() != "")
                    bool.TryParse(dr["basis"].ToString(), out _basic);

                _guarule = dr["guaranteerule"].ToString();
                _cxlrule = dr["cancelrule"].ToString();

                _rpi = dr["RPI"].ToString();

                _currency = dr["currency"].ToString();

                _ratecat = dr["RateCat"].ToString();
            }
        }

        #region 公共属性

        [DataFieldAttribute("rate")]
        [GField("rate")]
        public string RateCode
        {
            get
            {
                return _rate;
            }
            set
            {
                _rate = value;
            }

        }


        /// <summary>
        /// 种类
        /// </summary>
        [DataFieldAttribute("RPI")]
        [GField("RPI")]
        public string RPI
        {
            get
            {
                return _rpi;
            }
            set
            {
                _rpi = value;
            }

        }

        /// <summary>
        /// 货币
        /// </summary>
        [DataFieldAttribute("currency")]
        [GField("currency")]
        public string Currency
        {
            get
            {
                return _currency;
            }
            set
            {
                _currency = value;
            }

        }

        /// <summary>
        /// 基础价
        /// </summary>
        [DataFieldAttribute("basis")]
        [GField("basis")]
        public bool Basis
        {
            get
            {
                return _basic;
            }
            set
            {
                _basic = value;
            }

        }

        /// <summary>
        /// 类别
        /// </summary>
        [DataFieldAttribute("RateCat")]
        [GField("RateCat")]
        public string RateCat
        {
            get
            {
                return _ratecat;
            }
            set
            {
                _ratecat = value;
            }

        }

        [DataFieldAttribute("name")]
        [GField("name")]
        public string Name
        {
            get
            {
                return _name;
            }
            set
            {
                _name = value;
            }
        
        }


        /// <summary>
        /// ID
        /// </summary>
        [DataFieldAttribute("id", "pk")]
        [GField("id", FieldTypeEnum.PK, true)]
        public int ID
        {
            get { return _id; }
            set { _id = value; }
        }

        /// <summary>
        /// 
        /// </summary>
        [DataFieldAttribute("Property_id")]
        [GField("Property_id")]
        public int Pid
        {
            get { return _pid; }
            set { _pid = value; }
        }

        [DataFieldAttribute("status")]
        [GField("status")]
        public int State
        {
            get { return _status; }
            set { _status = value; }
        }

        /// <summary>
        /// 保证金号码
        /// </summary>
        [DataFieldAttribute("GuaranteeRule")]
        [GField("GuaranteeRule")]
        public string GuaranteeRule
        {
            get { return _guarule; }
            set { _guarule = value; }
        }


        /// <summary>
        /// 取消制度号
        /// </summary>
        [DataFieldAttribute("CancelRule")]
        [GField("CancelRule")]
        public string CancelRule
        {
            get { return _cxlrule; }
            set { _cxlrule = value; }
        }


        /// <summary>
        /// 描述
        /// </summary>
        [DataFieldAttribute("Desc1")]
        [GField("Desc1")]
        public string Description
        {
            get { return _Description; }
            set { _Description = value; }
        }

        /// <summary>
        /// 
        /// </summary>
        [DataFieldAttribute("updatetime")]
        [GField("updatetime")]
        public DateTime? updatetime
        {
            get { return _updatetime; }
            set { _updatetime = value; }
        }

        #endregion
    }
}
